package servic

import (
	"context"
	"fmt"
	"user-srv/basic/config"
	__ "user-srv/basic/proto"
	"user-srv/handler/model"
)

func (s *Server) BaseAdd(_ context.Context, in *__.BaseAddReq) (*__.BaseAddResp, error) {

	var base model.Base
	base.UserId = int(in.UserId)
	base.Title = in.Title
	if err := base.CreateBase(config.DB); err != nil {
		return nil, fmt.Errorf("草稿箱发布成功")
	}
	return &__.BaseAddResp{
		Id: int64(base.ID),
	}, nil
}
